package com.newyulong.implatform;

import android.app.Application;
import android.content.SharedPreferences;

import com.newyulong.implatform.service.AdService;
import com.newyulong.implatform.service.BusinessService;
import com.newyulong.implatform.service.UserService;

public class IMPApplication extends Application {

	// private static String TAG = "SaleHelperApplication";

	private String openId = "";
	
	private String requestUrl = "http://192.168.15.110/appstore/api/";

	public SharedPreferences sp;

	// public static String testRequestUrl =
	// "http://192.168.12.22:8089/API/api";//测试地址

	// 常用到的二个service
	public BusinessService productService;
	public UserService userService;
	public AdService adService;

	private static IMPApplication instance;

	public static IMPApplication getInstance() {
		return instance;
	}

	@Override
	public void onCreate() {
		super.onCreate();
		sp = getSharedPreferences("config", MODE_APPEND);


		instance = this;
		productService = new BusinessService(this);
		userService = new UserService(this);
		adService = new AdService(this);

	}

	
	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getRequestUrl() {
		if (requestUrl == null || "".equals(requestUrl)) {
			requestUrl = sp.getString("currentRequestUrl", "");
		}
		return requestUrl;
	}

	public void setRequestUrl(String requestUrl) {
		this.requestUrl = requestUrl;
	}



}